home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 117 / PC Guia 117.iso / Software / Utils / Software2 / Product11 / Setup.exe / MT-3.16-full-en_US / tools / write-default-templates < prev   
Encoding:
Text File  |  2004-07-12  |  737 b   |  34 lines

  1. #!/usr/bin/perl -w
  2. use strict;
  3.  
  4. use lib 'lib';
  5. use MT;
  6. use MT::Util qw( encode_html dirify );
  7.  
  8. my $mt = MT->new
  9.     or die MT->errstr;
  10.  
  11. my $tmpl = do 'lib/MT/default-templates.pl';
  12. print "<ul>\n";
  13. for my $t (@$tmpl) {
  14.     next if $t->{name} eq 'Stylesheet';
  15.     printf qq(<li><a href="#%s">%s</a></li>\n), dirify($t->{name}), $t->{name};
  16. }
  17. print "</ul>\n\n";
  18.  
  19. print "\n<form>\n\n";
  20. for my $t (@$tmpl) {
  21.     next if $t->{name} eq 'Stylesheet';
  22.     $t->{text} = $mt->translate_templatized($t->{text});
  23.     printf <<HTML, dirify($t->{name}), $t->{name}, encode_html($t->{text});
  24. <div class="template">
  25. <a name="%s"><h4>%s</h4></a>
  26. <textarea cols="60" name="text" rows="20" wrap="virtual">
  27. %s
  28. </textarea>
  29. </div>
  30. HTML
  31. }
  32.  
  33. print "\n</form>\n";
  34.